#ifndef _KEY_H
#define _KEY_H

#define KEY_CH_NUM	5		//key channel num
#define USE_DOUBLE_KEY		//double key enable
#define USE_LONG_KEY		//long key enable

typedef enum{
KeyVal_Null,
KeyVal_Single,
KeyVal_Double,
KeyVal_Long
}KeyValType;

typedef enum{
KeyCheckState_Null,
KeyCheckState_Chatter,
KeyCheckState_Press,
KeyCheckState_Done,
KeyCheckState_WaitDouble,
}KeyCheckStateType;

typedef enum{
KeyPress_On,
KeyPress_Off
}KeyPressStateType;

typedef struct{
	KeyCheckStateType KeyCheckState;
	unsigned int KeyPressMs;
	unsigned int KeyGapMs;
}KeyType;

#define KEY_CHATTER_MS		50			////0-50 :chatter
#define KEY_SHORT_MS		500			//500-1000 :signle
#define KEY_DOUBLE_GAP_MS	500			//500-1000 &0-500&500-1000 :double
#define KEY_LONG_MS			1000		//>1000 :long
//PS:500-1000 &0-500&>1000    :signle&double

//key cyc check delay ms
#define KEY_CHECK_CYC_MS	20


void KeyInit(void);
unsigned char KeySetHardKey(unsigned char,unsigned char key);//for test
unsigned char KeyGetHardKey(unsigned char);
void Key_Check_Cyc(void);//main cyc deal(must)

#endif